import axios from 'axios'

const API_BASE_URL = 'https://jsonplaceholder.typicode.com/posts' // 示例API，实际项目中替换为你的API

export const getArticles = async () => {
  const response = await axios.get(API_BASE_URL)
  return response.data
}

export const getArticleById = async (id) => {
  const response = await axios.get(`${API_BASE_URL}/${id}`)
  return response.data
}

export const getCategories = async () => {
  // 模拟分类数据
  return [
    { id: 1, name: '技术', count: 5 },
    { id: 2, name: '生活', count: 3 },
    { id: 3, name: '旅行', count: 2 }
  ]
}

export const getTags = async () => {
  // 模拟标签数据
  return [
    { id: 1, name: 'Vue', count: 3 },
    { id: 2, name: 'JavaScript', count: 4 },
    { id: 3, name: 'CSS', count: 2 },
    { id: 4, name: 'HTML', count: 1 }
  ]
}